#ifndef APPLICATION_H
#define APPLICATION_H

#include "Player.h"

namespace SolidityEngine{


//interface class for the solidity application
class Application
{
    static std::unique_ptr<Player> _player;

    public:
        static Scene* GetScene(){
            if(_player) return _player->_scene;
            return NULL;
        };

        static void SetScene(Scene* scene){
            if(_player) _player->_scene=scene;
        };

        static void Init(){
            _player = std::unique_ptr<Player>(new Player());
        };

        static void Play(){
            if(_player) {
                _player->_running=true;
                _player->_Loop();
            }
        };

        static void Stop(){
            if(_player) {
                _player->_running=false;
            }
        };

        static void SetScreenOffset(const Vector2D& offset){
            if(_player) _player->_screenoffset=offset;
        };

        static Vector2D GetScreenOffset(){
            if(_player) return _player->_screenoffset;
            return Vector2D(0,0);
        };

        static void SetScreenCenter(const Vector2D& center){
            SetScreenOffset(center-Vector2D(Screen::Width(),Screen::Height())*0.5f);
        };

        static Vector2D GetScreenCenter(){
            return GetScreenOffset()+Vector2D(Screen::Width(),Screen::Height())*0.5f;
        };

};

}

#endif // APPLICATION_H
